package com.cenntro.auth.controllers;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cenntro.auth.model.dbo.SysRolePermissionRefDO;
import com.cenntro.auth.model.vo.RolePermissionRefVO;
import com.cenntro.auth.service.SysRolePermissionRefService;
import com.cenntro.common.base.BaseController;
import com.cenntro.common.util.result.PageResult;
import com.cenntro.common.util.result.Result;

import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 账号角色关联表 前端控制器
 * </p>
 *
 * @author 
 * @since 2019-06-12
 */
@RestController
@RequestMapping("/rolePermissionRef")
public class SysRolePermissionRefController extends BaseController {

    @Resource
    private SysRolePermissionRefService sysRolePermissionRefService;
    /**
     * 查询角色列表
     * 
     * @param sysRoleVO
     * @return
     */
    @ApiOperation(value = "查询角色列表", notes = "查询角色列表")
    @RequestMapping(value = "/selectPage")
    @ApiModelProperty(value = "角色名称，不能是空")
    public Result selectPage(RolePermissionRefVO refVO) {
        SysRolePermissionRefDO refDO = new SysRolePermissionRefDO();
        refDO.setRoleId(refVO.getRoleId());
        refDO.setRefId(refVO.getRefId());
        refDO.setPermissionId(refVO.getPermissionId());
        List<SysRolePermissionRefDO> refList = sysRolePermissionRefService.selectPage(refDO);
        return PageResult.ok(refList);
    }
}
